#pragma once
#include <osgGA/GUIEventHandler>
class KeyEvent : public osgGA::GUIEventHandler
{
public:
	struct callback {
		virtual void operator()()=0;
	};

	KeyEvent()
	{
		s_instance = this;
	}

	void setCamera(osg::Camera *);

	void addEventHandle(callback *cb);
	static KeyEvent* instance();
protected:
	virtual bool handle(const osgGA::GUIEventAdapter& ea,
		osgGA::GUIActionAdapter& aa);
private:
	std::list< callback*> m_callbackList;
	static KeyEvent *s_instance;
	osg::Camera *m_mainCamera;
};